package com.px.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitConfig {

    /**
     * 订单队列
     * @return
     */
    @Bean
    public Queue orderQueue(){
        return new Queue("orderQueue",true,false, false);
    }

    /**
     * 订单交换机（直连交换机）
     * @return
     */
    @Bean
    public DirectExchange orderDirectExchange(){
        return new DirectExchange("orderExchange",true,false);
    }

    /**
     * 队列绑定交换机
     * @return
     */
    @Bean
    public Binding bindingRoutingQueue(){
        return BindingBuilder.bind(orderQueue()).to(orderDirectExchange()).with("getMessage");
    }


}
